/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package phd.dupenois.es.nplusn;

/**
 *
 * @param <T>
 * @author mpd209
 */
public class ObjectiveResult<T extends Number> {
    private T value;
    private Objective objective;
    public ObjectiveResult(T value, Objective objective){
        this.value = value;
        this.objective = objective;
    }

    /**
     * @return the value
     */
    public T getValue() {
        return value;
    }

    /**
     * @return the objective
     */
    public Objective getObjective() {
        return objective;
    }

    public boolean overBaseline(Baseline baseline){
        if(!baseline.getObjective().equals(this.objective))
            throw new IllegalArgumentException("Objective types do not match");
        return baseline.isObjectiveResultAboveBaseline(this);
    }

    public Domination compareValue(ObjectiveResult result){
        if(!result.getObjective().equals(this.objective))
            throw new IllegalArgumentException("Objective types do not match");
        return this.objective.compareValues(value, result.getValue());
    }
}
